function buffer2arraybuffer(buf){
    let length = buf.length;
    let arrBuf = new ArrayBuffer(length)
    let view = new DataView(arrBuf)
    for(let i = 0; i < length; i++){
        view.setUint8(i, buf[i])
    }
    return arrBuf
}

module.exports = buffer2arraybuffer